package com.rd.student.jike.class2.xuezhixin.day0801;

import java.util.Arrays;

public class TestMaopao {

    public static void main(String[] args) {
        int[] arr = {60,77,33,55,11,22,80};

        int lastChangeIndex = arr.length-1;
        int changeIndex = 0;
        for(int i = 0;i< arr.length-1;i++){
            boolean b = true;
           System.out.println("第" + (i+1) + "轮");
            for (int j = 0;j<lastChangeIndex;j++){
                if (arr[j] > arr[j+1]){
                    int num = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = num;
                    b = false;
                    changeIndex = j;
                }
                System.out.println(Arrays.toString(arr));
            }
            lastChangeIndex = changeIndex;
            if (b){
                break;
            }

        }

        System.out.println();
        System.out.print(Arrays.toString(arr));
    }
}
